
Vaca.Animal = new Class({
	ClassName: 'Animal',
	Extends: Vaca.BaseObject,
	talk: function() {
		this.sendMessageToPool({ say: 'bzzz!'});
	}
});
		
Vaca.Dog = new Class({
	ClassName: 'Dog',
	Extends: Vaca.Animal,
	talk: function() {
		this.sendMessageToPool({ say: 'guau!', targetClass: 'Cat'});
	},
	processPoolMessage: function(sender, msg) {
		if (msg.targetClass != this.ClassName) return;
		this.parent(sender, msg);
	}
});

Vaca.Cat = new Class({
	ClassName: 'Cat',
	Extends: Vaca.Animal,
	talk: function() {
		this.sendMessageToPool({ say: 'miauu!', targetClass: 'Dog'});
	},
	processPoolMessage: function(sender, msg) {
		if (msg.targetClass != this.ClassName) return;
		this.parent(sender, msg);
	}
});


new Vaca.Cat();
new Vaca.Cat();
new Vaca.Dog();
new Vaca.Animal();
new Vaca.Animal();

var dog    = new Vaca.Dog();
var cat    = new Vaca.Cat();
var animal = new Vaca.Animal();

animal.talk();
cat.talk();
dog.talk();
